#include <iostream>
#include <string>

#include "contacts.pb.h"

int main(){
    std::string str;

    {
        contacts::PepoleInfo info;
        info.set_name("lwj");
        info.set_age(21);

        if (info.SerializeToString(&str) == false){
            std::cout << "序列化失败" << std::endl;
            return -1;
        }

        std::cout << str << std::endl;
    }

    {
        contacts::PepoleInfo info;
        if (info.ParseFromString(str) == false){
            std::cout << "反序列化失败" << std::endl;
            return -1;
        }

        std::cout << "name: " << info.name() << " age: " << info.age() << std::endl;
    }
    
    return 0;
}